package controler;

import java.text.BreakIterator;

import view.Dictionary;
import view.Entertament;
import view.Help;
import view.OneDayOneLesson;
import model.ModelEvent;
import android.app.Activity;
import android.content.Intent;
import eventcontrant.ActionEvent;
import eventcontrant.ActionEventContrant;

public class UserControler {
	private static UserControler control;

	protected UserControler() {

	}

	public static UserControler getInstance() {
		if (control == null) {
			control = new UserControler();
		}

		return control;
	}

	public void handleSwitchActivity(ActionEvent e) {
		Intent intent;
		switch (e.action) {
		case ActionEventContrant.ONE_DAY_ONE_LESSON:
			Activity sender = (Activity) e.sender;
			intent = new Intent(sender, OneDayOneLesson.class);
			sender.startActivity(intent);
			break;

		case ActionEventContrant.DICTIONARY:

			Activity sender1 = (Activity) e.sender;
			intent = new Intent(sender1, Dictionary.class);
			sender1.startActivity(intent);
			break;

		case ActionEventContrant.ENTERTAMENT:
			Activity sender2 = (Activity) e.sender;
			intent = new Intent(sender2, Entertament.class);
			sender2.startActivity(intent);
			break;

		case ActionEventContrant.HELP:
			Activity sender3 = (Activity) e.sender;
			intent = new Intent(sender3, Help.class);
			sender3.startActivity(intent);
			break;
		default:
			break;

		}

	}

	public void handleViewEvent(ActionEvent e) {
		switch (e.action) {
		case ActionEventContrant.ONE_DAY_ONE_LESSON:
			ModelEvent.getInstance().requestgetonedayonelessson(e);
			break;

		default:
			break;
		}
	}

	public void handleModelEvent(ActionEvent modelEvent) {
		OneDayOneLesson sender;
		sender = (OneDayOneLesson) modelEvent.sender;
		sender.handleModelViewEvent(modelEvent);
	}
}
